home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / ssetup26.zip / MAINFRM.FR_ / MAINFRM.FRM
Text File  |  1995-07-27  |  9KB  |  299 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   0  'None
  5.    ClientHeight    =   1092
  6.    ClientLeft      =   1944
  7.    ClientTop       =   2604
  8.    ClientWidth     =   2520
  9.    ControlBox      =   0   'False
  10.    Height          =   1416
  11.    Left            =   1896
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1092
  17.    ScaleWidth      =   2520
  18.    Top             =   2328
  19.    Width           =   2616
  20. End
  21.  
  22. Sub Form_Load ()
  23. ' Be aware that the following 3D is not available
  24. ' at design time!
  25. ' NO NEED TO RETRIEVE THE HINSTANCE WITH VB...
  26.  
  27. ' Mke sure the user uses SETUP.EXE
  28. a% = ExtractParameters(Command$)
  29. If (a% = 0) Then
  30.   MsgBox "Please use SETUP.EXE to launch the installation..."
  31.   Unload Form1
  32.   End
  33. End If
  34. sTemp$ = szTempSetupPath$ + "CSETUP.DLL"
  35. hLibCSetup% = LoadLibrary(sTemp$)
  36. sTemp$ = szTempSetupPath$ + "UZSETUP.DLL"
  37. hLibUZSetupXXX% = LoadLibrary(sTemp$)
  38. sTemp$ = szTempSetupPath$ + "SGAUGE.DLL"
  39. hLibSGauge% = LoadLibrary(sTemp$)
  40. sTemp$ = szTempSetupPath$ + "CTL3D.DLL"
  41. hLibCTL3d% = LoadLibrary(sTemp$)
  42. hInstance% = 0
  43. a% = Ctl3dRegister(hInstance%)
  44. a% = Ctl3dAutoSubclass(hInstance%)
  45.  
  46.  
  47. a% = BringWindowToTop(Form1.hWnd)
  48.  
  49. '--------------------------------------------------------------
  50. 'Now we simply fill the layout list
  51. '--------------------------------------------------------------
  52. Section(1).Name$ = "Files"  'Section name
  53. Section(1).ELabel$ = "&Main program"  'US Label
  54. Section(1).FLabel$ = "&Programme principal"  'US Label
  55. Section(1).bSelected% = 0
  56. 'Section(1).Directory$ = "SUBDIR\" 'Not needed here
  57. 'Do the same for all the groups you plan to install...
  58.  
  59. IconEntry(1).szIconRelativeName$ = "NOTUSED.EXE" 'The program name
  60. IconEntry(1).EGroupName$ = "Setup Studio Demo"
  61. IconEntry(1).FGroupName$ = "DΘmonstration Setup Studio"
  62. IconEntry(1).EIconName$ = "Prog name"
  63. IconEntry(1).FIconName$ = "Programme"
  64. IconEntry(1).EIconText$ = "Some additional infos..."
  65. IconEntry(1).FIconText$ = "Infos complΘmentaires..."
  66. 'Do the same for all the icons you plan to install...
  67.  
  68.  
  69. '--------------------------------------------------------------
  70. 'Set the text colors using RGB
  71. '--------------------------------------------------------------
  72. lPanel1TitleColor& = RGB(192, 192, 192)
  73. lPanel1DetailColor& = RGB(0, 0, 138)
  74. lPanel2TitleColor& = RGB(192, 192, 192)
  75. lPanel2DetailColor& = RGB(0, 0, 138)
  76. lPanel3TitleColor& = RGB(192, 192, 192)
  77. lPanel3DetailColor& = RGB(0, 0, 138)
  78.  
  79. ' -------------------------------------------------
  80. ' Splash Dialog box
  81. ' -------------------------------------------------
  82. bRunningSetup% = 0
  83. Load Form2
  84. Form2.Show 0
  85. Do While (FirstCanClose% = 0)
  86. a% = DoEvents()
  87. Loop
  88. Unload Form2
  89. Form1.Show
  90.  
  91. ' -------------------------------------------------
  92. ' Choose directory Dialog Box
  93. ' -------------------------------------------------
  94. If (bIsSetupOK% <> 0) Then
  95.   Load Form3
  96.   Form3.Show 1
  97.   a% = BringWindowToTop(Form3.hWnd)
  98.   Do While (DirCanClose% = 0)
  99.      a% = DoEvents()
  100.   Loop
  101.   Unload Form3
  102.   If (bUserAbort% = 1) Then
  103.     Unload Form1
  104.     End
  105.   End If
  106. End If
  107.  
  108. ' -------------------------------------------------
  109. ' Options Dialog Box
  110. ' -------------------------------------------------
  111. If (iPanel2Bitmap% = 0) Then
  112.    If (szPanel2Title$ <> "") Then
  113.       a% = SetTextLogo(szPanel2Title$, szPanel2TitleFont$, iPanel2TitleSize%, lPanel2TitleColor&, bPanel2Title3D%, bPanel2TitleBold%)
  114.       If (szPanel2Detail$ <> "") Then
  115.      a% = SetTextDetail(szPanel2Detail$, szPanel2DetailFont$, iPanel2DetailSize%, lPanel2DetailColor&, bPanel2Detail3D%, bPanel2DetailBold%)
  116.       End If
  117.       a% = SetLogoType(1)
  118.    End If
  119. Else
  120.    'a% = SetLogo(hInstance%, iPanel2Bitmap)
  121.    'SetLogoType( 0)
  122. End If
  123.  
  124. Refresh
  125.  
  126. If (bIsSetupOK% <> 0) Then
  127.    Load Form4
  128.    Form4.Show 1
  129.    a% = BringWindowToTop(Form4.hWnd)
  130.    Do While (OptionCanClose% = 0)
  131.       a% = DoEvents()
  132.    Loop
  133.    Unload Form4
  134.    If (bUserAbort% = 1) Then
  135.       Unload Form1
  136.       End
  137.    End If
  138. End If
  139.  
  140.  
  141. ' -------------------------------------------------
  142. ' LOG file
  143. ' -------------------------------------------------
  144. If (bUseLogFile% = 1) Then
  145.   szLogFile$ = UserPath$ + szLogFileName$
  146.   a% = SetLogFile(szLogFile$)
  147. End If
  148.  
  149.  
  150.  
  151. ' -------------------------------------------------
  152. ' Setup process screen
  153. ' -------------------------------------------------
  154. If (iPanel3Bitmap% = 0) Then
  155.   If (szPanel3Title$ <> "") Then
  156.     a% = SetTextLogo(szPanel3Title$, szPanel3TitleFont$, iPanel3TitleSize%, lPanel3TitleColor&, bPanel3Title3D%, bPanel3TitleBold%)
  157.     If (szPanel3Detail$ <> "") Then
  158.        a% = SetTextDetail(szPanel3Detail$, szPanel3DetailFont$, iPanel3DetailSize%, lPanel3DetailColor&, bPanel3Detail3D%, bPanel3DetailBold%)
  159.     End If
  160.     a% = SetLogoType(1)
  161.   End If
  162. Else
  163.   'a% = SetLogo(hInstance%, iPanel3Bitmap)
  164.   'SetLogoType( 0)
  165. End If
  166.  
  167. Refresh
  168.  
  169. ' -------------------------------------------------
  170. ' Setup process
  171. ' -------------------------------------------------
  172. If (bUserAbort% <> 1) Then
  173. iResult% = GoSetup(Form1.hWnd, 1)
  174. End If
  175.  
  176. ' -------------------------------------
  177. ' Setup successful
  178. ' -------------------------------------
  179. If (iResult% = SETUP_SUCCESSFUL) Then
  180.  If (Section(1).bSelected% <> 0) Then   'Install icons and so on
  181.     ' -------------------------------------
  182.     ' Icons
  183.     ' -------------------------------------
  184.     If (bInstallIcons% <> 0) Then
  185.       If (iLanguage% = LANGUAGE_FRENCH) Then
  186.      mResult% = MsgBox("Souhaitez vous installer les ic⌠nes de " + szProductName$ + " ?", 36)
  187.       Else
  188.      mResult% = MsgBox("Would you like to install the " + szProductName$ + " icons?", 36)
  189.       End If
  190.       If (mResult% = 6) Then
  191.      'We make sure PROGMAN is still the shell on this PC...
  192.      szBuffer$ = String$(255, 0)
  193.      szSystemIni$ = szWinDir$ + "SYSTEM.INI"
  194.      a% = GetPrivateProfileString("boot", "shell", "", szBuffer$, 20, szSystemIni$)
  195.      iZero% = InStr(szBuffer$, Chr$(0))
  196.      szTemp$ = Left$(szBuffer$, iZero% - 1)
  197.      a% = SetupHasWin4Look()
  198.      If (a% = 0) Then
  199.      If ((szTemp$ <> "PROGMAN") And (szTemp$ <> "progman")) Then
  200.        If (iLanguage% = LANGUAGE_FRENCH) Then
  201.       Message$ = "Le gestionnaire de programme n' est pas prΘsent!L' installation des ic⌠nes peut Θchouer et une installation manuelle sera peut Ωtre nΘcessaire"
  202.        Else
  203.       Message$ = "ProgMan not detected! Icons installation can fail, amybe a manual icons installation will be required."
  204.        MsgBox Message$
  205.      End If
  206.      End If
  207.      ' Now we walk through the icons list
  208.      For a% = 1 To NumberOfIcons%
  209.      IconPath$ = UserPath$ + IconEntry(a%).szIconRelativeName$
  210.      b% = DoesFileExist(IconPath$, 1)
  211.      If (b%) Then
  212.       If (IconEntry(a%).EIconText$ <> "") Then
  213.     If (iLanguage% = LANGUAGE_FRENCH) Then
  214.       AddItemToProgman IconEntry(a%).FGroupName$, IconPath$, IconEntry(a%).FIconName$, IconEntry(a%).FIconText$
  215.       c% = ShowProgmanGroup(IconEntry(a%).FGroupName$)
  216.     Else
  217.       AddItemToProgman IconEntry(a%).EGroupName$, IconPath$, IconEntry(a%).EIconName$, IconEntry(a%).EIconText$
  218.       c% = ShowProgmanGroup(IconEntry(a%).EGroupName$)
  219.     End If
  220.       End If
  221.      End If
  222.      Next a%
  223.      Refresh
  224.       End If
  225.     End If
  226.     ' -------------------------------------
  227.     ' WinFile Associations
  228.     ' -------------------------------------
  229.     If (bMakeAssociation% <> 0) Then
  230.       For a% = 0 To NumberOfAsso
  231.     Assoc$ = UserPath$ + WFAsso(a%).szProgName$
  232.     b% = DoesFileExist(Assoc$, 1)
  233.     If (b% <> 0) Then
  234.       b% = CreateWinFileAssociation(WFAsso(a%).szExt$, Assoc$)
  235.     End If
  236.       Next a%
  237.     End If
  238.     ' -------------------------------------
  239.     ' Shell
  240.     ' -------------------------------------
  241.     If (szLaunch$ <> "") Then
  242.       szLaunchType$ = Right$(szLaunch$, 3)
  243.       If ((szLaunchType$ = "HLP") Or (szLaunchType$ = "hlp")) Then
  244.      DestHelpFile$ = UserPath$ + szLaunch$
  245.      a% = DoesFileExist(DestHelpFile$, 1)
  246.      If (a% <> 0) Then
  247.     If (iLanguage% = LANGUAGE_FRENCH) Then
  248.        b% = MsgBox("L' installation est terminΘe. Souhaitez vous parcourir le fichier d' aide maintenant?", 36)
  249.     Else
  250.        b% = MsgBox("Installation complete. Would you like to have a look at the HLP file right now?", 36)
  251.     End If
  252.     If (b% = 6) Then
  253.        c% = WinHelp(0, DestHelpFile$, 3, 0)
  254.     End If
  255.      End If
  256.       Else 'it must be a program!
  257.     szLaunch2$ = UserPath$ + szLaunch$
  258.     a% = DoesFileExist(szLaunch2$, 1)
  259.     If (a% <> 0) Then
  260.        a% = Shell(szLaunch2$, 1)
  261.     End If
  262. End If
  263.     End If
  264.  End If 'First section selected
  265. Else
  266.  ' -------------------------------------
  267.  ' Bad setup
  268.  ' -------------------------------------
  269.  If (iLanguage% = LANGUAGE_FRENCH) Then
  270.    b% = MsgBox("L' installation est icomplΦte. Vous devez rΘinstaller le programme!", 48)
  271.  Else
  272.    b% = MsgBox("Installation not complete. You should reinstall this program!", 48)
  273.  End If
  274. End If
  275. End If
  276.  
  277. Unload Form1
  278. End
  279.  
  280. End Sub
  281.  
  282. Sub Form_Paint ()
  283. a% = ShowMainWindow(Form1.hWnd)
  284. If (Form3.Visible <> 0) Then
  285. a% = BringWindowToTop(Form3.hWnd)
  286. End If
  287. End Sub
  288.  
  289. Sub Form_Unload (Cancel As Integer)
  290.  
  291. a% = Ctl3dUnregister(hInstance%)
  292. 'a% = DeleteSystemDir()
  293. FreeLibrary (hLibCSetup%)
  294. FreeLibrary (hLibUZSetupXXX%)
  295. FreeLibrary (hLibSGauge%)
  296. FreeLibrary (hLibCTL3d%)
  297. End Sub
  298.  
  299.